<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/prime.xhtml">

	<ui:define name="content">
		<h:form id="form">
			<p:growl id="growl" showDetail="true"/>  
		
			<p:dataTable id="list" var="status" value="#{processingStatusBean.statuses}" rows="10" paginator="true">		
				<f:facet name="header">
					Processing Status Viewer
				</f:facet>
				
				<p:column sortBy="#{status.id}" style="width:20px">
					<f:facet name="header" >
						<h:outputText value="ReleaseID" />
					</f:facet>
					<h:outputText value="#{status.id}"/>
				</p:column>

                <p:column sortBy="#{status.startTime}" style="width:100px">
                	<f:facet name="header" >
                    	<h:outputText value="Start Time" />
                    </f:facet>
                    <h:outputText value="#{status.startTime}"/>
                </p:column>

                <p:column style="width:5px">
	            	<p:commandLink  async="true" oncomplete="deleteDlg.show()" styleClass="ui-icon ui-icon-trash">
		            	<f:setPropertyActionListener value="#{status}" target="#{processingStatusBean.selected}" />
	            	</p:commandLink>
        		</p:column>
        		
        		<f:facet name="footer">
					<p:commandButton value="Update" icon="ui-icon-refresh" update="@form" action="#{processingStatusBean.update}"/>
				</f:facet>
			</p:dataTable>

            <p:confirmDialog widgetVar="deleteDlg" id="deleteDialog" header="Delete" message="MSB should do this for you, are you sure?"
                               width="400" showEffect="fade" hideEffect="fade" modal="true" closable="false" severity="alert" dynamic="true">
                  <h:panelGroup layout="block" style="text-align: right">
                      <p:commandButton value="Yes" actionListener="#{processingStatusBean.delete}" oncomplete="deleteDlg.hide()" update="list, growl" />
                      <p:commandButton value="No" actionListener="#{processingStatusBean.cancel}" oncomplete="deleteDlg.hide()" update="growl"/>
                  </h:panelGroup>
            </p:confirmDialog>
		</h:form>
	</ui:define>
</ui:composition>